function getCookie (name){
	var dcookie = document.cookie;
	var cname = name + "=";
	var clen = dcookie.length;
	var cbegin = 0;
	while (cbegin < clen){
	var vbegin = cbegin + cname.length;
	if (dcookie.substring(cbegin, vbegin) == cname){
	var vend = dcookie.indexOf (";", vbegin);
	if (vend == -1) vend = clen;
	return unescape(dcookie.substring(vbegin, vend));
	}
	cbegin = dcookie.indexOf(" ", cbegin) + 1;
	if (cbegin == 0) break;
	}
	
	return null;
}

function setCookie (name, value, expires, pcook)
{
	if (!expires) expires = new Date();
	document.cookie = name + "=" + value + "; expires=" +expires.toGMTString() + "; path=" + pcook;
}
